#ifndef _WORKER_H_
#define _WORKER_H_

#include "EventProcessor.h"
#include "EventProcessorImp.h"
#include "Message.h"
#include <vector>

using namespace std;

class WorkerImp : public EventProcessorImp {
	private:

		DistributedCounter &dCounter;

		EventProcessor Master;
		
	//	bool generatorsDone;

	public:
		WorkerImp(EventProcessor& _master, DistributedCounter& _dCounter);  
	
		void SendTheSum(vector<int>& subset,int start);	

		MESSAGE_HANDLER_DECLARATION(AddThis);
			
		//MESSAGE_HANDLER_DECLARATION(GenDone);

		MESSAGE_HANDLER_DECLARATION(Die);

		void SendReady();	
};

// Interface class
class Worker : public EventProcessor {
 public:
  Worker(EventProcessor& _controller, DistributedCounter& _dCounter);
};

inline Worker::Worker(EventProcessor& _controller, DistributedCounter& _dCounter){
  evProc = new WorkerImp(_controller,_dCounter);
}

#endif 
